<?php

namespace App\Admin\Controllers\Audit;

use App\Admin\Actions\Audit\AuditAfterSaleAction;
use App\Admin\Grid\NGrid;
use App\Models\AfterSaleModel;
use Encore\Admin\Controllers\AdminController;

class AuditAfterSaleController extends AdminController
{
    protected $title = '售后审核';

    protected function grid(): NGrid
    {
        $grid = new NGrid(new AfterSaleModel);
        $grid->model()->where('status', 0);
        $grid->column('id', 'ID')->sortable();
        $grid->column('serial_number', '序列号');
        $grid->column('pay_price', '支付金额');
        $grid->actions(function ($action) {
            $action->disableEdit();
            $action->disableDelete();
            $action->disableView();
            $action->add(new AuditAfterSaleAction);
        });
        $grid->disableCreateButton();
        $grid->disableActions(false);
        return $grid;
    }
}
